<?php include "inc/conn.php";?><?php include "inc/pubs.php";?>
<?php 
$stime=microtime(true); 
$dtime= time();

$getal = trim($_POST['name']);
$typer = trim($_POST['time']);
if(!$getal){
$typer=$_COOKIE['typer'];
$getal=$_COOKIE['names'];
}

$keys = "域名A记录查询,域名Txt记录查询,域名Cname记录查询,域名Mx记录查询;";
$keys .= "域名解析,解析记录查询;站长实用工具。";
?>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes" />
<title><?php echo $title;?></title>
<meta name="description" content="<?php echo $keys;?>">
<meta name="keywords" content="<?php echo $keys;?>">
<!-- 请保留以下信息:不显示的-->
<meta name="author" content="yujianyue, admin@ewuyi.net">
<meta name="copyright" content="www.12391.net">
<!-- 请保留以上信息:不显示的-->
<link href="inc/css/style.css?t=<?php echo $dtime;?>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="inc/js/js.js?t=<?php echo $dtime;?>"></script>
</head>
<body onLoad="inst();">
<div class="html">
<div class="divs" id="divs">
<div id="head" class="head">
<?php echo $title;?>
</div>
<div class="main" id="main">
<form name="queryForm" method="POST" action="?t=<?php echo $dtime;?>" onsubmit="return startRequest(0);">
<div class="so_box" id="11">
<?php if(strlen($getal)>0){ ?>
<input name="name" type="text" class="txts" id="name" value="<?php echo $getal;?>" placeholder="请输入<?php echo $tiaojian1;?>" onfocus="st('name',1)" onBlur="startRequest(2)" />
<?php }else{ ?>
<input name="name" type="text" class="txts" id="name" value="请输入<?php echo $tiaojian1;?>" placeholder="请输入<?php echo $tiaojian1;?>" onfocus="st('name',1)" onBlur="startRequest(2)" />
<?php } ?>
<div class="more" id="clearkey">
<select name="time" id="time" class="time" >
<option value="Ip"<?php if($typer=="Ip"){echo " selected";}?>>解析Ip</option>
<option value="A"<?php if($typer=="A"){echo " selected";}?>>A记录</option>
<option value="Txt"<?php if($typer=="Txt"){echo " selected";}?>>Txt</option>
<option value="Cname"<?php if($typer=="Cname"){echo " selected";}?>>Cname</option>
<option value="Mx"<?php if($typer=="Mx"){echo " selected";}?>>Mx</option>
<option value="Ns"<?php if($typer=="Ns"){echo " selected";}?>>Dns</option>
<option value="Srv"<?php if($typer=="Srv"){echo " selected";}?>>Srv</option>
<option value="Aaaa"<?php if($typer=="Aaaa"){echo " selected";}?>>Aaaa</option>

</select>
</div>
<div class="more so_but" id="clearkey">
<input type="submit" name="button" class="buts" id="sub" value="立即查询" />
</div>
</div>
<div class="so_bus" id="tishi">

<!--你的其他说明在这里添加：开始-->

<strong>输入须知:</strong><br>
仅输入域名部分(可二级域名),部分查询类型比如DNS需输入顶部域名。<br>

<div class="none"><?php echo $keys;?></div>
<div class="none"><?php echo $title;?></div>

<!--你的其他说明在这里添加：结束-->
</div>
<div id="tishi1" style="display:none;">请输入<?php echo $tiaojian1;?></div>
</form>
<?php

if( strlen($getal)>0 && strlen($typer)>0 ){

echo "<h2>域名<strong>$typer</strong>记录查询结果</h2>\r\n";

$query = strtolower($getal);
$typer = strtolower($typer);
  $CACHE = "没有查询到解析信息...";

 switch($typer){

 case 'ns': //=== NS记录 ===//
 $CACHE = dns_get_record($query, DNS_NS);
 
 break;
 
 case 'a': //=== A记录 ===//
 $CACHE = dns_get_record($query, DNS_A);
 
 break;
 
 case 'aaaa'://=== AAAA记录 ===//
 $CACHE = dns_get_record($query, DNS_AAAA);

 break;
 
 case 'mx'://=== MX记录 ===//
 $CACHE = dns_get_record($query, DNS_MX);

 break;
 
 case 'cname'://=== CNAME记录 ===//
 $CACHE = dns_get_record($query, DNS_CNAME);

 break;

 case 'txt'://=== TXT记录 ===//
 $CACHE = dns_get_record($query, DNS_TXT);

 break;
 
 case 'srv'://=== SRV记录 ===//
 $CACHE = dns_get_record($query, DNS_SRV);

 break;
 
 case 'ip': //===直接显示 IP ===//
 $CACHE = gethostbyname($query);

 break;


 default:
  $CACHE = "value t is error:t=cname/mx/txt/ns/a/srv/aaaa...";

 } 


if(is_array($CACHE)){
$ii=0;
foreach ($CACHE as $keylist){
$ii++;
echo "<table cellspacing=\"0\" class=\"table\" cellpadding=\"0\">\r\n";
foreach ($keylist as $key=>$val){
echo "<tr><td class=\"r\">$key</td><td class=\"l\">$val</td></tr>\r\n";
}
 echo "</table>\r\n";
}
if($ii<1){
echo "<table cellspacing=\"0\" class=\"table\" cellpadding=\"0\">\r\n";
echo "<tr><td class=\"r\">提示1</td><td class=\"l\">无记录</td></tr>\r\n";
echo "</table>\r\n";
}
}else{
echo "<table cellspacing=\"0\" class=\"table\" cellpadding=\"0\">\r\n";
echo "<tr><td class=\"r\">查询结果</td><td class=\"l\">$CACHE</td></tr>\r\n";
echo "</table>\r\n";
}

}else{
?>
<div class="so_bus" >

<!--你的其他说明在这里添加：开始-->

<strong>主要功能:</strong><br>
可查域名解析的IP，以及A、CNAME、MX、NS、TXT、AAAA、SRV等解析记录。<br>

<strong>作用意义:</strong><br>
即时查询域名解析信息（本地不缓存）。<br>
1. 解析IP/A/Cname：用于网站管理员判断解析是否生效。<br>
2. MX：可用于判断邮箱是否有效以减低无效邮箱率。<br>
3. TXT：常用于网站所有者认证,比如腾讯域名邮箱的所有者认证。<br>
4. ....<br>
5. 部分解析使用负载均衡或CDN加速等，查询结果仅供参考。<br>

<!--你的其他说明在这里添加：结束-->
</div>
<?php
}
$etime=microtime(true);
$total=$etime-$stime;
echo "<!--页面执行时间：{$total} ]秒-->";
?>
</div>
<div class="boto" id="boto">
<!-- 请保留以下广告:不显示的-->
<div class="none">
<a href="http://add.yichaxin.com" target="_blank" title="小微企业免费工资查询系统">易查薪</a>
</div>
<!-- 请保留以上广告:不显示的 -->
&copy;<?php echo date('Y');?>&nbsp; <a href="<?php echo $copyu;?>" target="_blank"><?php echo $copyr;?></a>
</div>
</div>
</div>
</body>
</html>